package ai

import (
	"project-info/src/handle/ai"
	"project-info/src/router/req"
	"project-info/src/router/variable"

	"github.com/gin-gonic/gin"
)

func init() {
	variable.InitRouteFunc = append(variable.InitRouteFunc, InitAiRoute)
}

func InitAiRoute(e *gin.Engine) {
	aiGroup := req.NewGroup("/ai").NeedToken().SetUpGroup(e)
	reqs := []*req.Conf{
		// HTTP接口（保持向后兼容）
		req.NewPost("/chat", ai.AIChat),
		// WebSocket接口（支持多轮对话）
		req.NewGet("/ws", ai.AIWebSocketHandler),
		// 对话历史接口
		req.NewGet("/history", ai.GetAIChatHistory),
	}
	req.BatchSetUpRouter(aiGroup, reqs)
}
